<script setup lang="ts">
import { useRoute } from 'vue-router'
import { ref, watch } from 'vue'

const route = useRoute()
const show = ref<boolean>()
watch(route, (newValue) => {
  show.value = newValue.meta.hidden
})
</script>

<script lang="ts">
export default {
  name: 'App'
}
</script>

<template>
  <div class="container">
    <router-view />
    <van-tabbar placeholder route v-show="!show">
      <van-tabbar-item replace to="/home" icon="home-o">首页</van-tabbar-item>
      <van-tabbar-item replace to="/category" icon="apps-o">分类</van-tabbar-item>
      <van-tabbar-item replace to="/zhide" icon="flower-o">值得买</van-tabbar-item>
      <van-tabbar-item replace to="/cart" icon="shopping-cart-o">购物车</van-tabbar-item>
      <van-tabbar-item replace to="/my" icon="manager-o">个人</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<style scoped lang="less">
.container {
  height: 100%;

  :deep(.van-tabbar) {
    position: fixed;
    bottom: 0;
    z-index: 1000;
  }
}
</style>
